<#include "../common/_layout.html"/>
<@layout>
<div class="pageFormContent" layouth="300">
	<h2 class="contentTitle">入库单</h2>
	<form id="ioForm" method="post" action="wms/form/iosave" class="pageForm">
	<input type="hidden" id="id" name="id" value="">
	<input type="hidden" id="type" name="form.type" value="0">
	<input type="hidden" id="status" name="form.status" value="0">
	<input type="hidden" id="detailList" name="detailList">
	<fieldset>
		<legend>单据信息</legend>
		<dl>
			<dt>入库仓库：</dt>
			<dd>
				<select name="form.inStorage" class="required combox">
					<option value="">---请选择---</option>
					<#list storageList as s>
					<option value="${(s.id)!}">${(s.name)!}</option>
					</#list>
				</select>
			</dd>
		</dl>
		<dl>
			<dt>供应商：</dt>
			<dd>
				<select name="form.customer" class="required combox">
					<option value="">---请选择---</option>
					<#list customerList as s>
					<option value="${(s.id)!}">${(s.name)!}</option>
					</#list>
				</select>
			</dd>
		</dl>
		<dl>
			<dt>入库时间：</dt>
			<dd>
				<input type="text" name="form.optime" value="" class="required textInput date" format="yyyy-MM-dd HH:mm:ss" readonly="true">
				<a class="inputDateButton" href="javascript:void(0);">选择</a>
			</dd>
		</dl>
		<dl>
			<dt>作业人：</dt>
			<dd>
				<select name="form.worker" class="required combox">
					<option value="">---请选择---</option>
					<#list employeList as s>
					<option value="${(s.id)!}">${(s.name)!}</option>
					</#list>
				</select>
			</dd>
		</dl>
	</fieldset>
	</form>
	<fieldset>
		<legend>单据明细</legend>
		<dl style="width:330px;">
			<dt style="width:40px;">仓位：</dt>
			<dd style="width:280px;">
				<input type="text" id="binCode" name="binCode" class="left required textInput">
				<div class="left buttonActive"><div class="buttonContent"><button type="button" id="StorageBinBtn" onclick="storageBinSearch(this);" action="/wms/form/searchStorageBin">查询</button></div></div>
				<select id="storageBins" name="storageBins" class="left combox hidden" onchange="selectStorageBin(this);">
					<option value="">---请选择---</option>
				</select>
				<span class="clear"></span>
			</dd>
		</dl>
<script id="storageBinTpl" type="text/template">
	<option value="">---请选择---</option>
	{@each _ as o,index}
	<option value="@{o.id}###@{o.binCode}">@{o.binCode}</option>
	{@/each}
</script>
		<dl style="width:420px;">
			<dt style="width:40px;">货物：</dt>
			<dd style="width:350px;">
				<input type="text" id="materialId" name="tag" class="left required textInput">
				<div class="left buttonActive"><div class="buttonContent"><button type="button" id="materialSearchBtn" onclick="materialSearch(this);" action="/wms/form/searchMaterial">查询</button></div></div>
				<select id="materials" name="materials" class="left combox hidden" onchange="selectMaterial(this);">
					<option value="">---请选择---</option>
				</select>
				<span class="clear"></span>
			</dd>
		</dl>
<script id="materialTpl" type="text/template">
	<option value="">---请选择---</option>
	{@each _ as o,index}
	<option value="@{o.id}###@{o.name}">@{o.id}【@{o.name}】</option>
	{@/each}
</script>
		<dl>
			<dt style="width:40px;">数量：</dt>
			<dd>
				<input type="text" id="quantity" name="formDetail.quantity" class="required textInput">
				<div class="buttonActive"><div class="buttonContent"><button type="button" onclick="add();">添加</button></div></div>
			</dd>
		</dl>
	</fieldset>
<script id="detailTpl" type="text/template">
	{@each _ as o,index}
	<tr>
	  <td>@{++index}</td>
	  <td>@{o.inStorageBinId}【@{o.inStorageBinCode}】</td>
	  <td>@{o.materialId}【@{o.materialName}】</td>
	  <td>@{o.quantity}</td>
	<td><a href="javascript:void(0);" onclick="del(this);" sid="@{o.id}">删除</a></td>
	</tr>
	{@/each}
</script>
	<table  class="tbfix">
		<thead>
			<tr>
				<th style="width:80px;">行号</th>
				<th style="width:80px;">仓位</th>
				<th style="width:180px;">货物</th>
				<th style="width:100px;">数量</th>
				<th style="width:200px;">操作</th>
			</tr>
		</thead>
		<tbody id="detailTplWrap"></tbody>
	</table>
</div>
<h2 class="contentTitle">&nbsp;</h2>
<ul class="toolBar">
	<li style="display:none;">
		<div class="buttonActive"><div class="buttonContent"><button type="button" onclick="saveForm(this);" status="0">草稿</button></div></div>
	</li>
	<li>
		<div class="buttonActive"><div class="buttonContent"><button type="button" onclick="saveForm(this);" status="1">入库</button></div></div>
	</li>
</ul>
<script src="static/js/wms/form.js" type="text/javascript"></script>
</@layout>